<!DOCTYPE html>
<html lang="en">

<head>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
    <meta name="author" content="">

    <title>Dexcalibur - Saver</title>

    <!-- styles -->
    <!--## pages/inc/tpl_css.html ##-->




    <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
        <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
        <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->

</head>

<body class="dxc-dark">


        <!-- Navigation -->
        <!--## pages/inc/menu.html ##-->

        
        <div id="page-wrapper">
          
               
                
            <h1 class="page-header">Manage project</h1>
            <div class="dxc-description">
                Save or open your project, export it as a file or import an external alias and ressources for this project. <br><i style="color: rgb(0, 247, 255);">Be aware, imported ressources will be  copied into the project workspace and loaded every time.</i>  
            </div>

            <div class="row"><div class="col-lg-12" id="alertcontainer"></div></div>

            <div class="row">
                <div class="col-lg-3">
                    <div class="card">
                        <div class="card-body">
                            <h5 class="card-title">Save hooks and aliases</h5>
                            <p class="card-text">
                                    This feature will save the aliases and the hooks into the project workspace.<br>
                                    If autosave is enabled, almost data should be already saved.
                            </p>
                            <button class="btn btn-primary save"><i class="fa fa-file"></i>&nbsp;Save</button>
                        </div>      
                    </div>
                </div>

                <div class="col-lg-3">
                    <div class="card">
                        <div class="card-body">
                            <h5 class="card-title">Restore hooks and aliases</h5>
                            <p class="card-text">
                                    This feature will load previously backed up aliases and hooks to the current project.<br>
                                    Be aware existing hooks and aliases will be override.
                            </p>
                            <button class="btn btn-primary opensave"><i class="fa fa-bolt"></i>&nbsp;Restore</button>
                        </div>      
                    </div>
                </div>

                <!-- TODO
                <div class="col-lg-3">
                    <div class="card">
                        <div class="card-body">
                            <h5 class="card-title">Export data</h5>
                            <p class="card-text">
                                    This feature will export selected data to special data file. This file can be fully or partially imported into another
                                    project or workspace. 
                            </p>
                            <button class="btn btn-primary export"><i class="fa fa-download"></i>&nbsp;Export</button>
                        </div>      
                    </div>
                </div>


                <div class="col-lg-3">
                    <div class="card">
                        <div class="card-body">
                            <h5 class="card-title">Import data</h5>
                            <p class="card-text">
                                This feature offers a way to import data - such as exported alias, hooks or bytecode - into the current project.
                                <br>Be aware import can override current data.
                               TODO
                                <div class="custom-control custom-switch">
                                    <input type="checkbox" class="custom-control-input" id="eraseoverride">
                                    <label class="custom-control-label" for="eraseoverride">Override existing data</label>
                                </div>
                            </p>
                            <button class="btn btn-primary import"><i class="fa fa-upload"></i>&nbsp;Import</button>
                        </div>      
                    </div>
                </div>-->
            </div>
            <!-- 
            <div class="row">
                <div class="col-lg-3">
                    <div class="card border-danger">
                        <div class="card-body">
                            <h5 class="card-title text-danger">Erase data</h5>
                            <p class="card-text">
                                    This feature will erase data according to selected items.
                                    <div class="custom-control custom-switch">
                                        <input type="checkbox" class="custom-control-input" id="erasehooks">
                                        <label class="custom-control-label" for="erasehooks">Hooks</label>
                                    </div>
                                    <div class="custom-control custom-switch">
                                        <input type="checkbox" class="custom-control-input" id="erasealias">
                                        <label class="custom-control-label" for="erasealias">Alias</label>
                                    </div>
                                    <div class="custom-control custom-switch">
                                        <input type="checkbox" class="custom-control-input" id="erasertfile">
                                        <label class="custom-control-label" for="erasertfile">Files gathered at runtime</label>
                                    </div>
                            </p>
                            <button class="btn btn-danger erasedata"><i class="fa fa-ben"></i>&nbsp;Erase (cannot be undone)</button>
                        </div>      
                    </div>
                </div>

                <div class="col-lg-6">
                    <div class="card border-danger">
                        <div class="card-body">
                            <h5 class="card-title text-danger">Schred project</h5>
                            <p class="card-text">
                                    This feature schred entire project folder using configured tool. 
                                    Depending of the configuration each file will be schred by using pre-configured tool.
                                    When schred terminates, an alert box will shows results (success or not). 
                                    In case of success, Dexcalibur emits '<i class="text-info">project-schreded-success</i>' events, allowing 
                                    plugins to do additional staff before application exists.

                                    <div class="custom-control custom-switch">
                                        <input type="checkbox" class="custom-control-input" id="schrednotify">
                                        <label class="custom-control-label" for="schrednotify">Notify unofficial plugins (disabled for confidentiality reason)</label>
                                    </div>
                            </p>
                            <button class="btn btn-danger schredproject"><i class="fa fa-file"></i>&nbsp;Schred (cannot be undone)</button>
                        </div>      
                    </div>
                </div>

                <div class="col-lg-3">
                    <div class="card border-warning">
                        <div class="card-body">
                            <h5 class="card-title text-warning">Archive</h5>
                            <p class="card-text">
                                This feature creates a zip archive of the project workspace, and stores it into the workspace. 
                                Any other remaining file are removed. It helps to free space. 
                                <br>This operation cannot be undone automatically. You need to uncompress it manually.
                            </p>
                            <button class="btn btn-warning schredproject">
                                <i class="fa fa-file"></i>&nbsp;Archive</button>
                        </div>      
                    </div>
                </div>
            </div>
        -->
        </div>



    <!--## pages/inc/tpl_js_end.html ##-->

    <script>


    $(document).ready(function() {
        $(".save").click(function(e){

            DexcaliburAPI.project.save(
                function(data){
                    if(data.success)
                        DexcaliburAPI.ui.alert.success("Hooks and aliases have been successfully saved.");
                    else
                        DexcaliburAPI.ui.alert.warning("Project have been partially saved due to an internal error   ");
                },
                function(data){
                    DexcaliburAPI.ui.alert.error("An error occured while backup.");
                    // $("#saveNotify").html("<span style='color:red'>(#1) Error :-(</span>");
                }
            );
        });


        $(".opensave").click(function(e){
            DexcaliburAPI.project.open(
                function(data){
                    DexcaliburAPI.ui.alert.success("Project succesfully opened :)");
                },
                function(data){
                    DexcaliburAPI.ui.alert.error("Project cannot be restored :(");
                }
            );
        });

        /*
        $(".impor").click(function(e){
            $.ajax("/api/inspectors/BytecodeCleaner", {
                method: "get",
                data: {
                    action: "goto_clean"
                },
                statusCode: {
                    200: function(data,err){
                        alert("Success");
                    },
                    404: function(data,err){
                        alert("An remote error occured.");
                    }
                }
            })
        });*/
    });

    </script>

</body>

</html>
